using Z = Mint<998244353>;
void solve()
{
	int n;
	cin >> n;

	Z ans = 0;
	Z inv = Z(n).inv();
	vector<Z> p(n + 1), f(n + 1);
	f[0] = p[0] = 1;
	for (int i = 1, x; i <= n; i++) {
		cin >> x;
		p[i] = f[i - 1] * inv;
		f[i] = p[i] + f[i - 1];
		ans += p[i] * x;
	}
	cout << ans;
}